package org.shilong.logic.login;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;

import org.shilong.Utilitys.Strings.Constants;
import org.shilong.mContext.db.DBContext;

public class LogicOfLogin {

	private LogicOfLogin(){}


	private static String rlt = null;
	

	public static String getLoginRlt( String ac_name, String ac_pwd ){
		
		CallableStatement cst = null;
		
		Connection conn = null;

		
		conn = DBContext.createInstance( DBContext.TYPE_MYSQL ).getConnector();

		try {
			cst = conn.prepareCall( Constants.LOGIN_SQL );

			cst.setString( 1, ac_name );
			cst.setString( 2, ac_pwd );

			cst.registerOutParameter( 3, java.sql.Types.VARCHAR );

			cst.execute();

			rlt = cst.getString( 3 );

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			
			try {
				cst.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

			cst = null;
		}

		return  rlt;

	} 


}
